#include<sys/types.h>
#include<sys/socket.h>
#include<arpa/inet.h>
#include<unistd.h>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include <netinet/in.h>

int main(int argc,char **argv)
{
    int fd;
    fd = socket(AF_INET,SOCK_STREAM|SOCK_NONBLOCK|SOCK_CLOEXEC,0);
    struct sockaddr_in addr;
    struct sockaddr_in c_addr;
    socklen_t csize=sizeof(struct sockaddr_in);
    addr.sin_family=AF_INET;
    addr.sin_port=htons(6666);
    addr.sin_addr.s_addr=htonl(INADDR_ANY);
    int ret=bind(fd,(struct sockaddr*)&addr,csize);
    listen(fd,128);
    int clientfd = accept(fd,(struct sockaddr*)&c_addr,&csize);
    char buff[]="hello world";
    send(clientfd,buff,strlen(buff),0);
    sleep(6);
    shutdown(fd,SHUT_RDWR);
    return 0;
}